import service from "../utils/request";
import Qs from 'qs'
    /*
     *  获取部门接口
     */
    export function getDepartmentList(requestData) {
        return service.request({
            url:'/getDepartmentList/',
            method:'post',
            params:requestData
        })
    }
    /*
     *  新增部门接口
     */
    export function addDepartment(requestData) {
        return service.request({
            url:'/addDepartment/',
            method:'post',
            params:requestData
        })
    }
    /*
     *  更新部门接口
     */
    export function updateDepartment(requestData) {
        return service.request({
            url:'/updateDepartment/',
            method:'post',
            params:requestData
        })
    }
     /*
      *  删除部门接口
      */
    export function deleteDepartment(pid){
        let data
        if(!Array.isArray(pid))
        data = [pid]
        else
        data = pid
        return service.request({
            url:'/deleteManyDepartment/',
            method:'post',
            data:{'data':data}
        }) 
    }
     /*
      *  id获取某部门接口
      */
    export function getDepartmentByID(pid){
        return service.request({
            url:'/getDepartmentByID/',
            method:'post',
            params:{"pid":pid},
            headers: {
                'Content-Type': 'application/json; charset=UTF-8'
            }
        })
    }

    /*
     * 根据关键字获取部门
     */
    export function  getDepartmentByKeyWord(KeyWord){
        return service.request({
            url:'/getDepartmentByKeyWord/',
            method:'post',
            params:{"KeyWord":KeyWord}
        })
    }

    /*
     *  改变状态接口
     */
    export function changeStatus(requestData){
        console.log(requestData);
        return service.request({
            url:'/changeStatusByID/',
            method:'post',
            params:requestData
        })
    }
    